import 'package:flutter/material.dart';
import '../style/decoration.dart';

// 入口海报组件
class EntranceBanner extends StatelessWidget {
  EntranceBanner(this.protect);

  final bool protect; // 是否遮罩
  final double imgHeight = 70; // 图像高度

  String _calLeftImageUrl() {
    return protect ? 'images/head_left_protect.png' : 'images/head_left.png';
  }

  String _calRightImageUrl() {
    return protect ? 'images/head_right_protect.png' : 'images/head_right.png';
  }

  Image _buildLogo() {
    return Image.asset('images/bilibili_spring.png',
        height: imgHeight, width: imgHeight * 2, fit: BoxFit.cover);
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.only(top: 10),
      decoration: bottomLineBoxDecoration,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: <Image>[
          Image.asset(
            _calLeftImageUrl(),
            height: imgHeight,
            fit: BoxFit.cover,
          ),
          _buildLogo(),
          Image.asset(_calRightImageUrl(), height: imgHeight, fit: BoxFit.cover)
        ],
      ),
    );
  }
}
